fi.foyt.svg.svgdom.FNISVGEllipseElementController = Class.create(fi.foyt.svg.svgdom.FNISVGElementController, {
  initialize: function($super){
  },
  moveTo: function(element, x, y){
  var cRx = parseFloat(element.getAttribute("rx"));
  if (isNaN(cRx))
    cRx = 0;
  var cRy = parseFloat(element.getAttribute("ry"));
  if (isNaN(cRy))
    cRy = 0;
  
    element.setAttribute("cx", x + cRx);
    element.setAttribute("cy", y + cRy);
  },
  moveBy: function (element, x, y) {
    var bbox = element.getBBox();
  this.moveTo(element, bbox.x + x, bbox.y + y);
  },
  resizeTo: function(element, width, height){ 
  var oRadiusX = parseFloat(element.getAttribute("rx"));
  if (isNaN(oRadiusX))
    oRadiusX = 0;
  var oRadiusY = parseFloat(element.getAttribute("ry"));
  if (isNaN(oRadiusY))
    oRadiusY = 0;
    
  var oPosX = parseFloat(element.getAttribute("cx"));
  if (isNaN(oPosX))
    oPosX = 0;
  var oPosY = parseFloat(element.getAttribute("cy"));
  if (isNaN(oPosY))
    oPosY = 0;
    
  var realPosX = oPosX - oRadiusX;
  var realPosY = oPosY - oRadiusY;  
  var w = width / 2;
  var h = height / 2;
  
  element.setAttribute("rx", w);
    element.setAttribute("ry", h);  
  element.setAttribute("cx", realPosX + w);
    element.setAttribute("cy", realPosY + h); 
  },
  resizeBy: function(element, scaleX, scaleY){
    var cRx = parseFloat(element.getAttribute("rx"));
  var cRy = parseFloat(element.getAttribute("ry"));
  var nRx = cRx * scaleX;
  var nRy = cRy * scaleY;
  
  this.moveBy(element, nRx - cRx, nRy - cRy);
  element.setAttribute("rx", nRx);        
    element.setAttribute("ry", nRy);  
  },
  supports: function (operation) {
    return ((operation == fi.foyt.svg.svgdom.FNISVGElementController.OPERATION_MOVE)||(operation == fi.foyt.svg.svgdom.FNISVGElementController.OPERATION_RESIZE));
  }
});